////
////  SuperviseCreateAtVC.swift
////  SBSafetyApp
////
////  Created by Lina on 2023/1/6.
////
//// 【首页-检查监督】检查任务-选择时间
//
//import Foundation
//import UIKit
//
//class SuperviseCreateAtVC: SubLevelViewController {
//    let detailV = SuperviseCreateAtView()
//    
//    var start: Date = Date() {
//        didSet {
//            reloadData()
//        }
//    }
//    
//    var end: Date = Date() {
//        didSet {
//            reloadData()
//        }
//    }
//    
//    var param: SuperviseParam!
//
//    init(withParam param: SuperviseParam!) {
//        super.init(nibName: nil, bundle: nil)
//        self.param = param
//    }
//    
//    required init?(coder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }
//    
//    override func viewDidLoad() {
//        super.viewDidLoad()
//        title = "选择时间"
//        view.backgroundColor = .bg
//        
//        setupUI()
//        
//        reloadData()
//    }
//    
//    func reloadData() {
//        self.param.start = start.elTodayDate()
//        self.param.end = end.elTodayDate()
//        detailV.startDateItem.value = start.elTodayDate()
//        detailV.endDateItem.value = end.elTodayDate()
//    }
//    
//    @objc func startSearchTapped() {
//        self.popup.bottomSheet(bgColor: .black.withAlphaComponent(0.65)) {
//            let v = CornerView(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: 386))
//            v.corners = SBRectCorner(topLeft: 12, topRight: 12, bottomLeft: 0, bottomRight: 0)
//            v.backgroundColor = .white
//            let rPopV = PickupPopView()
//            rPopV.dateMode = .date
//            rPopV.minimumDate = Date()
//            rPopV.date = start
//            rPopV.didSelectDateWith = { (picker, isComfirm) -> () in
//                if isComfirm {
//                    self.start = picker.date
//                    self.param.start = picker.date.elTodayDate()
//                }
//            }
//            v.addSubview(rPopV)
//            rPopV.snp.makeConstraints { (make) -> Void in
//                make.top.right.left.bottom.equalToSuperview()
//            }
//            return v
//        }
//    }
//    
//    @objc func endSearchTapped() {
//        self.popup.bottomSheet(bgColor: .black.withAlphaComponent(0.65)) {
//            let v = CornerView(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: 386))
//            v.corners = SBRectCorner(topLeft: 12, topRight: 12, bottomLeft: 0, bottomRight: 0)
//            v.backgroundColor = .white
//            let rPopV = PickupPopView()
//            rPopV.dateMode = .date
//            rPopV.date = end
//            rPopV.didSelectDateWith = { (picker, isComfirm) -> () in
//                if isComfirm {
//                    self.end = picker.date
//                    self.param.end = picker.date.elTodayDate()
//                }
//            }
//            v.addSubview(rPopV)
//            rPopV.snp.makeConstraints { (make) -> Void in
//                make.top.right.left.bottom.equalToSuperview()
//            }
//            return v
//        }
//    }
//    
//    @objc func submitTapped() {
//        print("self.param", self.param.type, self.param.deptId, self.param.taskName, self.param.start, self.param.end)
//
////        navigationController?.popToRootViewController(animated: true)
//        navigationController?.popToViewController(navigationController!.viewControllers[1], animated: true)
//    }
//    
//    // MARK: - Setup
//    
//    func setupUI() {
//        detailV.startDateItem.addTarget(self, action: #selector(startSearchTapped), for: .touchUpInside)
//        detailV.endDateItem.addTarget(self, action: #selector(endSearchTapped), for: .touchUpInside)
//        detailV.submitBtn.addTarget(self, action: #selector(submitTapped), for: .touchUpInside)
//        view.addSubview(detailV)
//        detailV.snp.makeConstraints { (make) in
//            make.left.right.equalToSuperview()
//            make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
//            make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
//        }
//    }
//}
